function deal(num) {
    let res = '';

    let numbers = num.toString().split('');
    // console.log(numbers, "numbers");

    for (let i = numbers.length - 1, count = 0; i >= 0; i--, count++) {
        if (count % 3 == 0 && count != 0) {
            res = ',' + res;
        }
        res = numbers[i] + res;
        // console.log('res循环', res);
    }
    return res;
}

console.log(deal(123456789));